package person.bing.fbcloud.leetcode;

import java.math.BigDecimal;

public class Q29 {
    public static void main(String[] args) {
        int divide = divide(100, 2);
        System.out.println(divide);
    }

    public static int divide(int dividend, int divisor) {
        BigDecimal divide = BigDecimal.valueOf(dividend).divide(BigDecimal.valueOf(divisor),BigDecimal.ROUND_DOWN);
        long longValue = divide.longValue();
        if (longValue > Integer.MAX_VALUE){
            return Integer.MAX_VALUE;
        }else {
            return divide.intValue();
        }
    }
}


